//
//  NINewMsgAlertView.m
//  gweAD
//
//  Created by Navinfo on 2017/10/24.
//  Copyright © 2017年 mengy. All rights reserved.
//

#import "NINewMsgAlertView.h"

@implementation NINewMsgAlertView{
    __weak IBOutlet UIView *contentView;
    
    __weak IBOutlet UIButton *evaluateButton;
    
}

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self awakeFromNib];
    }
    return self;
}

-(void)awakeFromNib
{
    [super awakeFromNib];
    [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self.class) owner:self options:nil];
    [self addSubview:contentView];
    
    contentView.translatesAutoresizingMaskIntoConstraints = NO;
    [self addConstraint:[NSLayoutConstraint constraintWithItem:contentView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]];
    [self addConstraint:[NSLayoutConstraint constraintWithItem:contentView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
    
    [self addConstraint:[NSLayoutConstraint constraintWithItem:contentView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0]];
    [self addConstraint:[NSLayoutConstraint constraintWithItem:contentView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0]];
    
    evaluateButton.layer.borderColor =[UIColor redColor].CGColor;
    evaluateButton.layer.borderWidth = 1.0f;
    evaluateButton.layer.masksToBounds = YES;
    evaluateButton.layer.cornerRadius = 5.0f;
}
- (IBAction)onCloseButtonClicked:(id)sender {
    [self.delegate ignoreButtonDidClicked];
    [self removeFromSuperview];
}
- (IBAction)onEvaluateButtonClicked:(id)sender {
    [self.delegate evaluateButtonDidClicked];
    [self removeFromSuperview];
}

@end
